//
//  EventTypeTitleView.m
//  ConvenientlyTake
//
//  Created by 张奇 on 2022/12/26.
//

#import "EventTypeTitleView.h"

@interface EventTypeTitleView ()

@property (nonatomic, strong) UIColor *color;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *eventNum;
@end

@implementation EventTypeTitleView


- (instancetype)initWithColor:(UIColor *)color title:(NSString *)title eventNum:(NSString *)eventNum {
    if (self = [super init]) {
        self.color = color;
        self.title = title;
        self.eventNum = eventNum;
        [self setupUI];
    }
    return self;
}


- (void)setupUI {
    
    UIView *colorView = [[UIView alloc] init];
    colorView.backgroundColor = self.color;
    colorView.layer.cornerRadius = 3;
    colorView.layer.masksToBounds = YES;
    [self addSubview:colorView];
    [colorView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.left.mas_equalTo(5);
        make.size.mas_equalTo(CGSizeMake(6, 6));
    }];
    
    QMUILabel *titlelabel = [[QMUILabel alloc] init];
    titlelabel.text = [NSString stringWithFormat:@" %@: ", R(self.title)];
    titlelabel.textColor = RGB(134, 144, 156);
//    titlelabel.font = TGAutoFont(14);
    titlelabel.font = [UIFont fontWithName:Ping_Regular size:14];
    [self addSubview:titlelabel];
    [titlelabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(colorView);
        make.left.equalTo(colorView.mas_right);
    }];
    
    QMUILabel *numlabel = [[QMUILabel alloc] init];
    numlabel.text = R(self.eventNum);
    numlabel.textColor = RGB(51, 51, 51);
    numlabel.font = TGAutoFont(13.5);
    [self addSubview:numlabel];
    [numlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(colorView);
        make.left.equalTo(titlelabel.mas_right);
    }];
    
}

@end
